<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JSX页面渲染</title>
    <script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
    <script crossorigin src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
    const root = ReactDOM.createRoot(document.getElementById('root'))

    class App extends React.Component {
        constructor(props) {
            super();
            this.state = {
                friend: {
                    name: "John Doe",
                    desc: "Developer modern",
                }
            }
        }
        render() {
            const { friend } = this.state;
            return (
                <div>
                    <h1>JSX页面渲染</h1>
                    <div>
                        <h2>{friend && friend.name}</h2>
                        <h5>{friend && friend.desc}</h5>
                    </div>
                </div>
            );
        }
    }
    root.render(<App />);
</script>
</body>
</html>